const fs = require('fs')
const {
	resolve
} = require('path')
const models = resolve(__dirname, '../schema/wechat')

function wechatdate() {

	fs.readdirSync(models)
		.filter(file => ~file.search(/^[^\.].*js$/))
		.forEach(file => require(resolve(models, file)))

}

module.exports = function() {
	return async function(ctx, next) {
		wechatdate();
		await next()
	}

}